package com.cxx.purchasecharge.core.config;

public enum ConfigurationProperties
{
    JPA_DB_DRIVER("jpa.dbDriver", true, null),
    JPA_DB_URL("jpa.dbUrl", true, null),
    JPA_DB_INSTANCE("jpa.dbInstance", true, null),
    JPA_DB_USER ("jpa.dbUser", true, null),
    JPA_DB_PASSWORD ("jpa.dbPassword", true, null),
    PC_DEFAULT_PASSWORD ("pc.defaultPassword", false, "CxxC@m!"),
    PC_INIT_USER_FLAG ("pc.initUserFlag", false, "false"),
    PC_INORDER_ADDPAID_COMMENT ("pc.inorder.addPaid.comment", false, "新增采购进货单"),
    PC_INORDER_DELPAID_COMMENT ("pc.inorder.delPaid.comment", false, "新增采购退货单"),
    PC_OUTORDER_ADDPAID_COMMENT ("pc.outorder.addPaid.comment", false, "新增销售进货单"),
    PC_OUTORDER_DELPAID_COMMENT ("pc.outorder.delPaid.comment", false, "新增销售退货单"),
    PC_SALESMAN_VIEWPAID_DAYS ("pc.salesman.viewPaid.days", false, "90");
    
    private String name;
    private boolean mandatory;
    private String defaultValue;

    private ConfigurationProperties (String name, boolean mandatory, String defaultValue)
    {
        this.name = name;
        this.mandatory = mandatory;
        this.defaultValue = defaultValue;
    }

    public static ConfigurationProperties lookup (String name)
    {
        if (name != null)
        {
            for (ConfigurationProperties confProp : values ())
            {
                if (confProp.getName ().equalsIgnoreCase (name))
                {
                    return confProp;   
                }
            }
        }
        return null;
    }

    public String getName ()
    {
        return name;
    }

    public boolean isMandatory ()
    {
        return mandatory;
    }

    public String getDefaultValue ()
    {
        return defaultValue;
    }
}
